package com.battle.service.controller.web;

import com.battle.pojo.param.userScreen.*;
import com.battle.pojo.vo.userScreen.*;
import com.battle.service.service.in.*;
import nirvana.core.domains.vo.PageResult;
import nirvana.core.domains.vo.ApiResult;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;

import java.util.List;

/**
 * web/用户筛选框
 * 【描 述】：
 * 【环 境】：J2SE
 * 【详 细】：
 */
@RestController
@RequestMapping("/userScreen/web")
public class UserScreenWebController {

    private final UserScreenService service;

    public UserScreenWebController(UserScreenService service) {
        this.service = service;
    }


    /**
     * 创建用户筛选框
     *
     * @param param
     * @return
     */
    @PostMapping("/createUserScreen")
    public ApiResult createUserScreen(@RequestBody @Valid CreateUserScreenParam param) {
        service.createUserScreen(param);
        return ApiResult.ok();
    }

    /**
     * 启动/禁用用户筛选框
     *
     * @param id
     */
    @GetMapping("/enabledUserScreen")
    public ApiResult enabledUserScreen(@RequestParam("id") Long id) {
        service.enabledUserScreen(id);
        return ApiResult.ok();
    }

    /**
     * 获取用户筛选框列表
     *
     * @param param
     * @return
     */
    @PostMapping("/getUserScreenList")
    public ApiResult<PageResult<GetUserScreenListVo>> getUserScreenList(@RequestBody GetUserScreenListParam param) {
        PageResult<GetUserScreenListVo> result = service.getUserScreenList(param);
        return ApiResult.ok(result);
    }


    /**
     * 获取用户筛选框下拉列表
     *
     * @return
     */
    @PostMapping("/getUserScreenDownList")
    public ApiResult<List<GetUserScreenDownListVo>> getUserScreenDownList(@RequestBody(required = false) @Valid GetUserScreenDownListParam param) {
        List<GetUserScreenDownListVo> list = service.getUserScreenDownList(param);
        return ApiResult.ok(list);
    }


}

